Translation:

30. Some He hath guided: others have (by their choice) deserved the loss of their way: in that they took the evil ones in preference to Allah for their friends and protectors and think that they receive guidance.

Notes (Tafseer)

1012. Guidance is for all. But in some it takes effect: in others the doors are closed against it, because they have taken Satan for their friend. If they have lost their way, they have richly deserved it; for they deliberately took their choice, even though, in their self-righteousness, they may think that their sin is their virtue, and that their Evil is their Good.